<?php
//DEFINE orderItem class
			//Each drop down form will store its submitted information in an object of class orderItem
			class orderItem{
				//private customerNum; //primary key in order table? 
				public $sandwichType;
				public $bread;
				public $meat;
				public $cheese;
				public $veggies;
				public $condiments;
				public $drink;
				public $chips;
				public $dessert;
				public $total;
				//constructor to store all submitted values of form
				public function __construct($sandwichType, $bread, $meat, $cheese, $veggies, $condiments, $drink, $chips, $dessert){
					$this->sandwichType = $sandwichType;
					$this->bread=$bread;
					$this->meat=$meat;
					$this->cheese=$cheese;
					$this->veggies=$veggies;
					$this->condiments=$condiments;
					$this->drink=$drink;
					$this->chips=$chips;
					$this->dessert=$dessert;
					$this->total = 0;
				}
				
				public function translateToEnglish(){
					switch($this->sandwichType){
						case "El Spencer: Sandwich clasico de jamon":
						$this->sandwichType = "Spencer's Ham Sandwich";
						break;
						case "Sandwich de pavo simple":
						$this->sandwichType = "Turkey Sandwich";
						break;
						case "El Duncan":
						$this->sandwichType = "The Duncan";
						break;
						case "Po' Boy de Camarones":
						$this->sandwichType = "Shrimp Po' Boy";
						break;
						case "El Nico: Sandwich de Pollo Picante":
						$this->sandwichType = "Nico's Spicy Chicken Sandwich";
						break;
						case "El Jonathan":
						$this->sandwichType = "The Jonathon";
						break;
						case "Sandwich hecho a la orden":
						$this->sandwichType = "Custom Sandwich";
						break;
						case "Sandwich Misterioso":
						$this->sandwichType = "Random Sandwich";
						break;
						case "Sandwich del Dia":
						$this->sandwichType = "Sandwich of the Day";
						break;
						case "Sandwich hecho a la orden":
						$this->sandwichType = "Custom Sandwich";
						break;
						case "Menu Infantil":
						$this->sandwichType = "Kid's Menu";
						break;
					}
					switch($this->bread){
						case "Integral":
						$this->bread = "Wheat";
						break;
						case "Blanco":
						$this->bread = "White";
						break;
						case "Frances":
						$this->bread = "French Baguette";
						break;
						case "Arabe":
						$this->bread = "Flat";
						break;
						case "N/A":
						$this->bread = "Empty";
						break;
					}
					switch($this->meat){
						case "Jamon":
						$this->meat = "Ham";
						break;
						case "Pavo":
						$this->meat = "Turkey";
						break;
						case "Camarones":
						$this->meat = "Shrimp";
						break;
						case "Pollo":
						$this->meat = "Chicken";
						break;
						case "Albondigas":
						$this->meat = "Meatball";
						break;
						case "N/A":
						$this->meat = "Empty";
						break;
					}
					switch($this->cheese){
						case "Americano":
						$this->cheese = "American";
						break;
						case "N/A":
						$this->cheese = "Empty";
						break;
					}
					switch($this->veggies){
						case "Tomates":
						$this->veggies = "Tomatoes";
						//multiple veggies?
						break;
						case "Cebollas":
						$this->veggies = "Onions";
						//multiple veggies?
						break;
						case "Aceitunas Negrass":
						$this->veggies = "Black Olives";
						//multiple veggies?
						break;
						case "Pimenton Verde":
						$this->veggies = "Green Peppers";
						//multiple veggies?
						break;
						case "Aguacate":
						$this->veggies = "Avocado";
						//multiple veggies?
						break;
						case "Lechuga":
						$this->veggies = "Lettuce";
						//multiple veggies?
						break;
						case "N/A":
						$this->veggies = "Empty";
						break;
					}
					switch($this->condiments){
						case "Salsa Ranch":
						$this->condiments = "Ranch";
						//more than one condiment?
						break;
						case "Mayonesa":
						$this->condiments = "Mayonnaise";
						//more than one condiment?
						break;
						case "Mostaza":
						$this->condiments = "Mustard";
						//more than one condiment?
						break;
						case "Salsa de Tomate":
						$this->condiments = "Tomato Sauce";
						//more than one condiment?
						break;
						case "Aji":
						$this->condiments = "Hot Sauce";
						//more than one condiment?
						break;
						case "N/A":
						$this->condiments = "Empty";
						break;
					}
					switch($this->drink){
					case "Peque&ntildea":
					$this->drink = "Small";
					break;
					case "Mediana":
					$this->drink = "Medium";
					break;
					case "Grande":
					$this->drink = "Large";
					break;
					case "N/A":
					$this->drink = "Empty";
					}
					switch($this->chips){
					case "Sabor Natural":
					$this->chips = "Potato Chips";
					break;
					case "Tortillas":
					$this->chips = "Corn Chips";
					break;
					case "Sabor Barbeque":
					$this->chips = "BBQ Chips";
					break;
					case "Sabor Crema y Cebollas":
					$this->chips = "Sour, Cream, and Onion";
					break;
					case "N/A":
					$this->chips = "Empty";
					break;
					}
					switch($this->dessert){
					//add all options for dessert and values
					case "Galleta":
					$this->dessert = "Cookie";
					break;
					case "Helado de Vainilla":
					$this->dessert = "Vanilla Ice Cream";
					break;
					case "N/A":
					$this->dessert = "Empty";
					break;
					}
				}
				
				public function orderTotal(){
				//use switch statements to add selected item cost to total
					$total = $this->total;
					switch($this->bread){
						case "Integral":
						$total = $total + 1.00;
						break;
						case "Blanco":
						$total = $total + 1.00;
						break;
						case "Frances":
						$total = $total + 1.20;
						break;
						case "Arabe":
						$total = $total + 1.10;
						break;
						case "N/A":
						$total = $total + 0.00;
						break;
						default:
						$total = $total;
						break;
					}
					switch($this->meat){
					//add all options for meat and values (no breaks as can have multiple meats)
						case "Jamon":
						$total = $total + 1.50;
						break;
						case "Pavo":
						$total = $total + 1.75;
						break;
						case "Camarones":
						$total = $total + 2.00;
						break;
						case "Pollo":
						$total = $total + 1.75;
						break;
						case "Albondigas":
						$total = $total + 2.00;
						break;
						case "Pastrami":
						$total = $total + 1.50;
						break;
						case "N/A":
						$total = $total + 0.00;
						break;
						default:
						$total = $total;
						break;
					}
					switch($this->cheese){
					//add all options for cheese and values
						case "Mozzarella":
						$total = $total + 1.00;
						break;
						case "Americano":
						$total = $total + 1.00;
						break;
						case "Pepper-Jack":
						$total = $total + 1.00;
						break;
						case "N/A":
						$total = $total + 0.00;
						break;
						default:
						$total = $total;
						break;
					}
					switch($this->veggies){
					//add all options for veggies and values (no breaks as can have multiple veggies)
						case "Tomates":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "Cebollas":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "Aceitunas Negras":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "Aguacate":
						$total = $total + 1.00;
						//multiple veggies?
						break;
						case "Pimenton Verde":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "Lechuga":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "N/A":
						$total = $total + 0.00;
						//default
						break;
						default:
						$total = $total;
						break;
						
						
					}
					switch($this->condiments){
					//add all options for condiments and values (no breaks as can have multiple condiments)
						case "Salsa Ranch":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "Mayonesa":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "Mostaza":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "Salsa de Tomate":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "Aji":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "N/A":
						$total = $total + 0.00;
						break;
						default:
						$total = $total;
						break;
					}
					
					//Discount for Random Sandwich
					if(strcmp($this->sandwichType,"Sandwich Misterioso") == 0){
						$total = round(($total * 0.85),2);
					}
					//Discount for Sandwich of the day
					if(strcmp($this->sandwichType,"Sandwich del Dia") == 0){
						$total = round(($total * 0.85),2);
					}
					//Discount for Combo Deal
					if($total > 0 && strcmp($this->drink,"N/A") != 0){
						$total = $total - 1.00;
					}
					
					switch($this->drink){
					//add all options for drink and values
					case "Peque&ntildea":
					$total = $total + 1.25;
					break;
					case "Mediana":
					$total = $total + 1.50;
					break;
					case "Grande":
					$total = $total + 1.60;
					break;
					case "N/A":
					$total = $total + 0.00;
					default:
					$total = $total;
					break;
					}
					switch($this->chips){
					//add all options for chips and values
					case "Sabor Natural":
					$total = $total + 1.50;
					break;
					case "Doritos":
					$total = $total + 1.50;
					break;
					case "Tortillas":
					$total = $total + 1.50;
					break;
					case "Sabor Barbeque":
					$total = $total + 1.50;
					break;
					case "Sabor Crema y Cebollas":
					$total = $total + 1.50;
					break;
					case "N/A":
					$total = $total + 0.00;
					break;
					default:
					$total = $total;
					break;
					}
					switch($this->dessert){
					//add all options for dessert and values
					case "Galleta":
					$total = $total + 1.00;
					break;
					case "Brownie":
					$total = $total + 1.50;
					break;
					case "Helado de Vainilla":
					$total = $total + 1.00;
					break;
					case "N/A":
					$total = $total + 0.00;
					break;
					default:
					$total = $total;
					break;
					}
					
					if(strcmp($this->sandwichType,"Premio Gratis") == 0){
						$total = 0.00;
					}
					
					if(strcmp($this->sandwichType, "Free Kid's Meal") == 0){
                        $total = 0.00;
                    }
					$this->total = $total;
					return (float)$total;
				}
				//Method that pushes information to database
			}
            ?>